package com.wuyoucar.controller;

import com.wuyoucar.common.ResultBean;
import com.wuyoucar.entity.TUser;
import com.wuyoucar.service.AdminLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin")
public class adminLoginController {
    @Autowired
    private AdminLoginService adminLoginService;

    //管理员账号密码登录
    @RequestMapping("/login")
    public ResultBean adminLogin(TUser tUser){
        TUser user = adminLoginService.adminLogin(tUser);
        if (user!=null){
            return new ResultBean(200,"success",user);
        }
        return new ResultBean(400,"账号或密码输入错误",0);
    }
}
